package com.demo.exce;

/**
 * @Author WaveHi
 * @Date 26/7/2021 上午 10:50
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 求1~10和
 */
public class WhileDemo3 {

    public static void main(String[] args) {

        //定义变量sum存储求和结果
        int sum = 0;

        //定义循环控制变量
        int count = 1;

        //循环求和
        while(count <= 10){
            sum += count;
            count++;
        }
        System.out.println("sum = " + sum);

    }

}
